# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Francois Boulogne <fboulogne at april dot org>

pkgname=python-qrcode
_pkgname=${pkgname#python-}
pkgver=7.4.2
pkgrel=3
pkgdesc='Python library to generate QR codes'
arch=('any')
url='https://github.com/lincolnloop/python-qrcode'
license=('BSD')
depends=('python' 'python-typing_extensions' 'python-pypng')
optdepends=('python-pillow: faster but not python native backend')
makedepends=('python-'{build,installer,wheel} 'python-setuptools')
checkdepends=('python-pytest')
_archive="$_pkgname-$pkgver"
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_archive.tar.gz")
sha512sums=('a8642845990341034e39c43ef674f5b4ce8d3175a44d6062f711af2c24ffd45bda5f3ecf8a7825b7ebafe734b6396d52a37bb59177c544f921e43eaa9f1f5405')

build() {
  cd "$_archive"
  python -m build -wn
}

check() {
  cd "$_archive"
  pytest
}

package() {
  cd "$_archive"
  python -m installer -d "$pkgdir" dist/*.whl
  install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
